﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using BLL;

namespace GeniusAdminWebApplication
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //初始化系统主菜单
            User admin = (User)HttpContext.Current.Session["admin"];
            if (admin == null)
            {
                Response.Redirect("login.aspx");
                return;
            }
            UserActionService uas = new UserActionService();
            if (uas.getUserAction(admin, 1) != null)
            {
                ph_user_actions.Controls.Add(new LiteralControl("<li id='l_user_manager'><a href='userList.aspx'>成员管理</a></li>"));
            }
            if (uas.getUserAction(admin, 2) != null)
            {
                ph_user_actions.Controls.Add(new LiteralControl("<li id='l_resource_manager'><a href='resourceList.aspx'>资源管理</a></li>"));
            }
            if (uas.getUserAction(admin, 3) != null)
            {
                ph_user_actions.Controls.Add(new LiteralControl("<li id='l_system_manager'><a href='system.aspx'>系统管理</a></li>"));
            }
            if (admin.status == 3) //超级管理员
            {
                ph_user_actions.Controls.Add(new LiteralControl("<li id='l_admin_manager'><a href='admin.aspx'>超级管理员</a></li>"));
            }

        }
    }
}
